package com.crape.account.dao.impl;

import java.util.HashMap;
import java.util.Map;

import com.crape.account.dao.IAcctVisitorDAO;
import com.crape.common.exceptions.DAOException;
import com.crape.common.ibatis.SqlMapClientDaoSupportEx;

public class AcctVisitorDAOImpl extends SqlMapClientDaoSupportEx implements IAcctVisitorDAO {

    @Override
    public Long countAcctVisitor(Long visitorid, Long accountid) throws DAOException {
        if (visitorid == null && accountid == null) {
            return 0L;
        }
        Map<String, Long> params = new HashMap<String, Long>();
        params.put("visitorid", visitorid);
        params.put("accountid", accountid);
        return (Long) this.queryObject("countAcctVisitor", params);
    }

    @Override
    public void insertAcctVisitor(Long visitorid, Long accountid) throws DAOException {
        if (visitorid == null || accountid == null) {
            return;
        }
        Map<String, Long> params = new HashMap<String, Long>();
        params.put("visitorid", visitorid);
        params.put("accountid", accountid);
        this.insert("insertAcctVisitor", params);
    }

    @Override
    public void updateAcctVisitor(Long visitorid, Long accountid) throws DAOException {
        if (visitorid == null || accountid == null) {
            return;
        }
        Map<String, Long> params = new HashMap<String, Long>();
        params.put("visitorid", visitorid);
        params.put("accountid", accountid);
        this.update("updateAcctVisitor", params);
    }

}
